<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
#pic{filter:alpha(opacity:30);opacity:0.3;}
</style>

<script>
window.onload=function(){
	var pic=document.getElementById('pic');
	pic.onmouseover=function(){
		startMove(100)	
	};
	pic.onmouseout=function(){
		startMove(30)	
	};
};
var timer=null;
var alpha=30;
function startMove(target){
	var pic=document.getElementById('pic');
	clearInterval(timer);
	timer=setInterval(function(){
		var speed=0;
		if(alpha<target){
			speed=10	
		}else{
			speed=-10;	
		};	
		if(alpha==target){
			clearInterval(timer);
		}else{
			alpha+=speed;
			pic.style.filter='alpha:(opacity:'+alpha+')';	
			pic.style.opacity=alpha/100;
		};
		
	},50)	
}
</script>
</head>

<body>
<img id="pic" src="../../img/5.jpg" />
</body>
</html>
